package com.example.leo.mycharmingstudent.a0904.generics;

import android.view.View;

/**
 * Created by Leo on 2020/9/4.
 */

public class Pair<T, E, Q, V> {
    private T first;
    private T second;

    private E third;

    public Pair(T first, T second, E third) {
        this.first = first;
        this.second = second;
        this.third = third;
    }

    public T getFirst() {
        return first;
    }

    public T getSecond() {
        return second;
    }

    public E getThird() {
        return third;
    }

    /**
     * 这是泛型方法
     * 注意：
     * 1.泛型方法和泛型类互不干涉
     * 2.泛型方法和普通类互不干涉，也就是说，普通类里面，也可以定义泛型方法
     */
    public <A> A getA(A a){
        return a;
    }

    //不可以指定具体类型  通配符？是具体类型，详见HandlerActivity 233行
    /*public <? extends View> ? getB(int a){
        return ?;
    }*/

    //可以声明泛型类型，详见HandlerActivity 233行
    public <G extends View> G getC(G a){
        return a;
    }
}
